package com.aop.demo.test;

import java.util.concurrent.SynchronousQueue;

public class BlockingQueue {
    public static void main(String[] args) throws Exception {
        SynchronousQueue<String> queue = new SynchronousQueue<>();

        new Thread(() -> {
            try {
                System.out.println(queue.take());
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }).start();

        queue.put("aaa");

        //queue.add("aaa");   Queue full
        System.out.println(queue.size());
    }
}
